
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8" />
	<title>千郡医疗-我的代理</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" th:href="@{/weixin/css/style.css}" />
	<link rel="stylesheet" th:href="@{/weixin/css/dropload.css}" />
    <script type="text/javascript"  th:src="@{/weixin/js/adaptive.js}"></script>
	<script type="text/javascript"  th:src="@{/weixin/js/fastclick.min.js}"></script>
	<script type="text/javascript"  th:src="@{/weixin/js/zepto.min.js}"></script>
	<script type="text/javascript"  th:src="@{/weixin/js/dropload.min.js}"></script>
</head>
<body>
	<div class="kVal">
			<div class="top tc">
				<p>我的推荐累计K值</p>
				<p class="money" th:text="${allKValue}"></p>
				<div class="box-h t-b">
					<div class="flex">
						<p class="price" th:text="${todayKValue}"></p>
						<p>我的推荐今日K值</p>
					</div>
					<div class="flex">
						<p class="price" th:text="${balanceKValue}"></p>
						<p>我的推荐已结算K值</p>
					</div>
					<div class="flex">
						<p class="price" th:text="${unBalanceKValue}"></p>
						<p>我的推荐待结算K值</p>
					</div>
				</div>
			</div>

	<section class="myAgent wrapper">
		<div class="ktab">
			<table>
				<thead>
					<tr>
						<td>我的推荐</td>
						<td>月份</td>
						<td>我的推荐已结算K值</td>
						<td>我的推荐待结算K值</td>
					</tr>
				</thead>
				<tbody id="context">
				</tbody>
			</table>
		</div>

	</section>
	</div>
</body>
<script type="text/javascript">
/*<![CDATA[*/
$(function(){
	page = 0;
    $('.wrapper').dropload({
	    //scrollArea : window,
	    autoLoad : true,//自动加载
	    loadDownFn : function(me){
	     window.history.pushState(null, document.title, window.location.href);
	        $.ajax({
	            type: 'GET',
	            url:'/qianjun/weixin/customer/agentlist?page='+page,
	            dataType: 'json',
	            success: function(data){
	                if(data.content.length == 0){
	                    me.lock();
	                    me.noData();
	                    me.resetload();
	                    return;
	                }

			        var result = '';
	                for(var i=0; i< data.content.length; i++){
	                  result+=content(data.content[i]);
	                }
	                $('#context').append(result);
	                page++;
	                me.resetload();
	            },
	            error: function(xhr, type){
	                alert('Ajax error!');
	                me.resetload();
	            }
	        });
	    }
	});
});

function content(data){
	var html = '<tr onclick=toDetail(' + data[0] + ')><td>' + data[1] + '</td><td>' + data[2] + '</td><td>' + data[3] + '</td><td>' + data[4] + '</td></tr>';
	return html;
	/* return '<li><a href="/qianjun/weixin/order/tolist?customerId='+data.id+'">'+
			'<p class="name">'+data.name+'</p>'+
			'<p class="tel">'+data.phoneNo+'</p>'+
			'</a></li>'; */
}

function toDetail(id){
	 window.location.href =  "/qianjun/weixin/order/toRebateBook?distributorId=" + id;
}

/*]]>*/
</script>
</html>